//
//  ViewController.m
//  RecruitFuturesApp
//
//  Created by ping on 2020/9/24.
//  Copyright © 2020 JJTechnology. All rights reserved.
//

#import "TabbarViewController.h"
#import "BaseNavoigationViewController.h"
#import "FRQHomeViewController.h"
#import "FRQSettingsViewController.h"
@interface TabbarViewController ()

@end

@implementation TabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setChildViewController];
    self.navigationController.navigationBarHidden = YES;
    
    UITabBarAppearance *appearance = [UITabBarAppearance new];
    // 去掉半透明效果
    appearance.backgroundEffect = nil;
    self.tabBar.standardAppearance = appearance;
    self.tabBar.backgroundColor=skUIColorFromRGB(0x4e555f);
}
- (void)setChildViewController
{
    [self addChildVc:[[FRQHomeViewController alloc] init] titles:@"Galleries" images:@"ico_bottom_nav_galleries_nor" selectedImage:@"ico_bottom_nav_galleries_sel"];
    
    [self addChildVc:[[FRQSettingsViewController alloc] init] titles:@"Settings" images:@"ico_bottom_nav_settings_nor" selectedImage:@"ico_bottom_nav_settings_sel"];
}
- (void)addChildVc:(UIViewController *)childVc titles:(NSString *)title images:(NSString *)image selectedImage:(NSString *)selectedImage
{
    childVc.title = title;
    childVc.tabBarItem.image = [UIImage imageNamed:image];
    
    childVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    [childVc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName : skUIColorFromRGB(0xdbdedd)} forState:UIControlStateNormal];
    
    [childVc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName : skphUIColorFromRGB(0x44cd2c,0.8)} forState:UIControlStateSelected];
    
    
    BaseNavoigationViewController *navigationVc = [[BaseNavoigationViewController alloc] initWithRootViewController:childVc];
    [self addChildViewController:navigationVc];
}

@end
